//
//  Nine_nineCollectionViewCell.m
//  EarnBao
//
//  Created by iMac on 15/3/5.
//  Copyright (c) 2015年 杭州赚宝科技有限公司. All rights reserved.
//

#import "Nine_nineCollectionViewCell.h"
#import "Nine_nine.h"
#import "UIImageView+WebCache.h"

@implementation Nine_nineCollectionViewCell

- (void)setSubview
{
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    self.productImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.width)];
    [self.contentView addSubview:_productImageView];
    
    self.free_post_nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.bounds.size.width/30, self.contentView.bounds.size.width, self.contentView.bounds.size.width*29/30, self.contentView.bounds.size.width/4)];
    _free_post_nameLabel.textColor = [UIColor grayColor];
    _free_post_nameLabel.font = [UIFont systemFontOfSize:12.0];
    _free_post_nameLabel.numberOfLines=2;
    [self.contentView addSubview:_free_post_nameLabel];
    
    self.lottery_priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.bounds.size.width/30, self.contentView.bounds.size.width*39/32, self.contentView.bounds.size.width/3, self.contentView.bounds.size.width/8)];
    _lottery_priceLabel.font = [UIFont boldSystemFontOfSize:16.0];
    _lottery_priceLabel.textColor = [UIColor redColor];
    [self.contentView addSubview:_lottery_priceLabel];
    
    self.market_priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.bounds.size.width/3 + self.contentView.bounds.size.width/30, self.contentView.bounds.size.width * 39/32, self.contentView.bounds.size.width/3, self.contentView.bounds.size.width/8)];
    _market_priceLabel.font = [UIFont boldSystemFontOfSize:10.0];
    [self.contentView addSubview:_market_priceLabel];
    
    self.shop_typeImageView = [[UIImageView alloc]initWithFrame:CGRectMake(self.contentView.bounds.size.width*5/6, self.contentView.bounds.size.width * 39/32, self.contentView.bounds.size.width/8, self.contentView.bounds.size.width*3/32)];
    [self.contentView addSubview:_shop_typeImageView];
}

//初始化
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setSubview];
    }
    return self;
}

-(void)setNine_nine:(Nine_nine *)nine_nine
{
    //第三方方法加载图片
    [_productImageView sd_setImageWithURL:[NSURL URLWithString:nine_nine.pic_m] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    _lottery_priceLabel.text = [NSString stringWithFormat:@"￥%@",nine_nine.lottery_price];
    _market_priceLabel.text = [NSString stringWithFormat:@"￥%@",nine_nine.market_price];
}

@end
